<div id="pagination">
	<div id="quickpages">
  		<span>Chuyển nhanh:</span><select onchange="changePage(this.value);">
  		<?php
  		 foreach ($this->pagesInRange as $page){
  		 	if($page == $this->current)
   				echo "<option value='".$page."' selected='selected'>".$page."</option>";
			else echo "<option value='".$page."'>".$page."</option>";
   				
   		} 
  		?>	
  		</select>
  		<script type="text/javascript">
  		function changePage(page){
  	  		var url = location.href;
  	  		var reg = new RegExp("_p[0-9]+");
  	  		if(reg.test(url)) url = url.replace(reg, "_p"+page);
  	  		location.href=url;
  		}
  		</script>
	</div>
	<div id="pages">
		<span>Trang: </span>
<?php 
    if (isset($this->previous)){
    	if(isset($this->pCategory)){
         	echo "<a href='".$this->url(array(
											'page'=>'_p'.$this->previous, 
											'cat_slug' => $this->pCategory->slug,
											'man_name' => $this->man->name
											),
									 	'man_pcategory')
         		."'>[Trước]</a>";
    	}else{
    		echo "<a href='".$this->url(array(
											'page'=>'_p'.$this->previous, 
											'man_name' => $this->man->name
											),
									 	'man')
         		."'>[Trước]</a>";
    	}
    }
    foreach ($this->pagesInRange as $page){
    	if(isset($this->pCategory)){
    		if ($page != $this->current){
	        	echo  "<a href='".$this->url(array(
												'page'=>'_p'.$page, 
												'cat_slug' => $this->pCategory->slug,
												'man_name' => $this->man->name
												),
										 	'man_pcategory')
						."'>[" . $page . "]</a>";
		   	}else{
		        echo "<span class='current'>[".$page . "]</span>";
		    }	
    	}else {
    		if ($page != $this->current){
	        	echo  "<a href='".$this->url(array(
												'page'=>'_p'.$page, 
												'man_name' => $this->man->name
												),
										 	'man')
						."'>[" . $page . "]</a>";
		   	}else{
		        echo "<span class='current'>[".$page . "]</span>";
		    }	
    	}  
   	}
	if (isset($this->next)){
		if(isset($this->pCategory)){ 
   			echo "<a href='".$this->url(array(
											'page'=>'_p'.$this->next, 
											'cat_slug' => $this->pCategory->slug,
											'man_name' => $this->man->name
											),
									 	'man_pcategory')
			."'>[Sau]</a>";
		}else{
			echo "<a href='".$this->url(array(
											'page'=>'_p'.$this->next, 
											'man_name' => $this->man->name
											),
									 	'man')
			."'>[Sau]</a>";
		}
	   
   }
  ?>
	</div>
	
</div>